#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

/* 2
   1
   a
   3
   a
   b
   c
   
   Yes
   No
*/

int t, n;
char buf[101][51];

bool check() {
    for (int i = 0; i < n / 2; i++) {
        bool falg = false;
        int len = strlen(buf[i]);
        int len2 = strlen(buf[n - i - 1]);
        for (int j = 0; j < len; j++) {
            for (int k = 0; k < len2; k++) {
                if (buf[i][j] == buf[n - i - 1][k]) {
                    falg = true;
                    break;
                }
            }
        }
        if (!falg) return false;
    }
    return true;
}

int main() {
    cin >> t;
    while (t--) {
        cin >> n;
        memset(buf, 0, sizeof(buf));
        for (int i = 0; i < n; i++)
            cin >> buf[i];
        if (n == 1) {
            cout << "Yes" << endl;
            continue;
        }
        if (check()) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}